home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1995 May / PC Answers CD-ROM 7 (Future Publishing) (May 1995).iso / vbits / code / cert / trk3_eg / vbx / frmstart.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-10-10  |  10.1 KB  |  368 lines

  1. VERSION 2.00
  2. Begin Form frmSwitcher 
  3.    BackColor       =   &H00FFFFC0&
  4.    Caption         =   "Autoload Switcher"
  5.    ClientHeight    =   4065
  6.    ClientLeft      =   1560
  7.    ClientTop       =   1785
  8.    ClientWidth     =   5610
  9.    Height          =   4755
  10.    Icon            =   FRMSTART.FRX:0000
  11.    Left            =   1500
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   4065
  14.    ScaleWidth      =   5610
  15.    Top             =   1155
  16.    Width           =   5730
  17.    Begin CommandButton cmdExit 
  18.       Caption         =   "E&xit"
  19.       Height          =   495
  20.       Left            =   4200
  21.       TabIndex        =   8
  22.       Top             =   3360
  23.       Width           =   1215
  24.    End
  25.    Begin TextBox txtFile 
  26.       Height          =   285
  27.       Left            =   1920
  28.       TabIndex        =   12
  29.       Top             =   360
  30.       Width           =   1935
  31.    End
  32.    Begin ComboBox lstType 
  33.       Height          =   300
  34.       Left            =   120
  35.       Style           =   2  'Dropdown List
  36.       TabIndex        =   11
  37.       Top             =   3000
  38.       Width           =   2055
  39.    End
  40.    Begin FileListBox File1 
  41.       Height          =   2175
  42.       Left            =   120
  43.       TabIndex        =   10
  44.       Top             =   360
  45.       Width           =   1575
  46.    End
  47.    Begin CommandButton cmdDel 
  48.       Caption         =   "&Delete"
  49.       Enabled         =   0   'False
  50.       Height          =   495
  51.       Left            =   4200
  52.       TabIndex        =   6
  53.       Top             =   2520
  54.       Width           =   1215
  55.    End
  56.    Begin CommandButton cmdModify 
  57.       Caption         =   "&Modify"
  58.       Enabled         =   0   'False
  59.       Height          =   495
  60.       Left            =   4200
  61.       TabIndex        =   5
  62.       Top             =   1920
  63.       Width           =   1215
  64.    End
  65.    Begin CommandButton cmdNew 
  66.       Caption         =   "&New"
  67.       Enabled         =   0   'False
  68.       Height          =   495
  69.       Left            =   4200
  70.       TabIndex        =   4
  71.       Top             =   1320
  72.       Width           =   1215
  73.    End
  74.    Begin CommandButton cmdSwitch 
  75.       Caption         =   "&Switch"
  76.       Enabled         =   0   'False
  77.       Height          =   495
  78.       Left            =   4200
  79.       TabIndex        =   3
  80.       Top             =   600
  81.       Width           =   1215
  82.    End
  83.    Begin ListBox lstvbx 
  84.       Height          =   1590
  85.       Left            =   1920
  86.       TabIndex        =   0
  87.       Top             =   960
  88.       Width           =   1935
  89.    End
  90.    Begin Label lblAvb 
  91.       BackColor       =   &H00FFFFC0&
  92.       Caption         =   "lblAvb"
  93.       Height          =   255
  94.       Left            =   4200
  95.       TabIndex        =   16
  96.       Top             =   360
  97.       Width           =   1455
  98.    End
  99.    Begin Label lblCurAVB 
  100.       BackColor       =   &H00FFFFC0&
  101.       Caption         =   "Current AVB:"
  102.       Height          =   255
  103.       Left            =   4200
  104.       TabIndex        =   15
  105.       Top             =   120
  106.       Width           =   1215
  107.    End
  108.    Begin Label lblDisCurDir 
  109.       BackColor       =   &H00FFFFC0&
  110.       Caption         =   "lblCurPath"
  111.       Height          =   255
  112.       Left            =   120
  113.       TabIndex        =   9
  114.       Top             =   3720
  115.       Width           =   3735
  116.    End
  117.    Begin Label lblPath 
  118.       BackColor       =   &H00FFFFC0&
  119.       Caption         =   "Path:"
  120.       Height          =   255
  121.       Left            =   120
  122.       TabIndex        =   14
  123.       Top             =   3480
  124.       Width           =   1095
  125.    End
  126.    Begin Label txtavbFile 
  127.       BackColor       =   &H00FFFFC0&
  128.       Caption         =   "Autolad &File"
  129.       Height          =   255
  130.       Left            =   1920
  131.       TabIndex        =   13
  132.       Top             =   120
  133.       Width           =   1215
  134.    End
  135.    Begin Label lblFileType 
  136.       BackColor       =   &H00FFFFC0&
  137.       Caption         =   "File &Type"
  138.       Height          =   255
  139.       Left            =   120
  140.       TabIndex        =   7
  141.       Top             =   2760
  142.       Width           =   1215
  143.    End
  144.    Begin Label lblVBXlist 
  145.       BackColor       =   &H00FFFFC0&
  146.       Caption         =   "&List of VBX's"
  147.       Height          =   255
  148.       Left            =   1920
  149.       TabIndex        =   2
  150.       Top             =   720
  151.       Width           =   1575
  152.    End
  153.    Begin Label lblVbxFiles 
  154.       BackColor       =   &H00FFFFC0&
  155.       Caption         =   "VB&X Autoload Files"
  156.       Height          =   255
  157.       Left            =   120
  158.       TabIndex        =   1
  159.       Top             =   120
  160.       Width           =   1935
  161.    End
  162.    Begin Menu mnuFile 
  163.       Caption         =   "&File"
  164.       Begin Menu mnuFileItem 
  165.          Caption         =   "&New"
  166.          Enabled         =   0   'False
  167.          Index           =   0
  168.       End
  169.       Begin Menu mnuFileItem 
  170.          Caption         =   "&Modify"
  171.          Enabled         =   0   'False
  172.          Index           =   1
  173.       End
  174.       Begin Menu mnuFileItem 
  175.          Caption         =   "&Delete"
  176.          Enabled         =   0   'False
  177.          Index           =   2
  178.       End
  179.       Begin Menu mnuFileItem 
  180.          Caption         =   "-"
  181.          Index           =   3
  182.       End
  183.       Begin Menu mnuFileItem 
  184.          Caption         =   "E&xit"
  185.          Index           =   4
  186.       End
  187.    End
  188.    Begin Menu mnuOption 
  189.       Caption         =   "&Options"
  190.       Begin Menu mnuSwitch 
  191.          Caption         =   "&Switch"
  192.          Enabled         =   0   'False
  193.       End
  194.       Begin Menu mnuChangeDir 
  195.          Caption         =   "&Change Dir"
  196.       End
  197.    End
  198. Option Explicit
  199. Sub buttonsOFF ()
  200. cmdSwitch.Enabled = False
  201. cmdModify.Enabled = False
  202. cmdDel.Enabled = False
  203. mnuFileItem(1).Enabled = False
  204. mnuFileItem(2).Enabled = False
  205. mnuSwitch.Enabled = False
  206. End Sub
  207. Sub buttonsOn ()
  208. cmdSwitch.Enabled = True
  209. cmdModify.Enabled = True
  210. cmdDel.Enabled = True
  211. mnuFileItem(1).Enabled = True
  212. mnuFileItem(2).Enabled = True
  213. mnuSwitch.Enabled = True
  214. End Sub
  215. Sub cmdDel_click ()
  216. Dim rs As Integer
  217. Dim Path As String
  218. If file1.ListIndex = -1 Then
  219.     MsgBox "You must first select a AVB file to delete."
  220.     Exit Sub
  221. End If
  222. If UCase$(Trim$(Right$(file1.FileName, 3))) = "AVB" Then
  223. rs = MsgBox("Delete the file " & UCase$(file1.FileName), MB_YESNO, "Delete")
  224. Select Case rs
  225.     Case IDYes
  226.         Path = convpath(CStr(lblDisCurDir.Caption))
  227.         Kill Path & file1.FileName
  228.         file1.Refresh
  229.         txtFile.Text = ""
  230. End Select
  231.     MsgBox "This program can only delete AVB files."
  232. End If
  233. buttonsOFF
  234. End Sub
  235. Sub cmdExit_Click ()
  236.     Unload Me
  237.     End
  238. End Sub
  239. Sub cmdModify_click ()
  240. Dim cnt As Integer
  241. Load frmmain
  242. For cnt = 1 To filelinecount
  243.     frmmain.lstVBX.AddItem vbxfiledata(cnt).linedata
  244. frmmain.Caption = txtFile.Text
  245. curmodfile = txtFile.Text
  246. frmmain.Show
  247. End Sub
  248. Sub cmdNew_click ()
  249. Dim rs As Integer
  250. Dim cnt As Integer
  251. rs = filllist(tempAVB, avbdir)
  252. Load frmmain
  253. frmmain.lstVBX.Clear
  254. For cnt = 1 To filelinecount
  255.     frmmain.lstVBX.AddItem vbxfiledata(cnt).linedata
  256. frmmain.Caption = "*.AVB"
  257. frmmain.Show
  258. End Sub
  259. Sub cmdSwitch_Click ()
  260. Dim filepath As String
  261. Dim rs As Integer
  262. filepath = convpath(CStr(lblDisCurDir.Caption))
  263. rs = MsgBox(UCase$(txtFile.Text) & " will become the new AUTOLOAD.MAK file.", MB_OKCANCEL, "Switch")
  264. If rs = IDOK Then
  265.     FileCopy filepath & txtFile.Text, "c:\vb\autoload.mak"
  266.     lblavb.Caption = UCase$(txtFile.Text)
  267. End If
  268. End Sub
  269. Sub File1_Click ()
  270. Dim rs As Integer
  271. Dim avbfname As String
  272. Dim avbfpath As String
  273. If file1.ListIndex = -1 Then
  274.     buttonsOFF
  275.     Exit Sub
  276. End If
  277. avbfname = file1.FileName
  278. avbfpath = file1.Path
  279. txtFile.Text = file1.FileName
  280. rs = filllist(avbfname, avbfpath)
  281. buttonsOn
  282. End Sub
  283. Sub Form_Activate ()
  284. file1.Refresh
  285. file1.Path = avbdir
  286. lblDisCurDir.Caption = avbdir
  287. End Sub
  288. Sub Form_Load ()
  289. lstType.AddItem "AutoSwitch (*.AVB)"
  290. lstType.AddItem "All (*.*)"
  291. lstType.ListIndex = 0
  292. GetINI
  293. dftDir = GetDefaultDir
  294. lblavb.Caption = GetCurAvb
  295. avbdir = dftDir
  296. tempAVB = "TEMPLATE.AVB"
  297. Set thelist = lstVBX
  298. End Sub
  299. Sub Form_Unload (Cancel As Integer)
  300. Call WriteDefaults
  301. End Sub
  302. Sub GetINI ()
  303. Dim rc As Integer
  304. Dim keyvalue As String, keydefault As String, keyname As String
  305. Dim sectionname As String, FileName As String
  306. Dim CurAvb As String
  307. FileName = "AutoSwVB.INI"
  308. sectionname = "Settings"
  309. keyname = "Dir"
  310. keydefault = CurDir
  311. keyvalue = String$(16, 0)
  312. rc = GetPrivateProfileString(sectionname, keyname, keydefault, keyvalue, Len(keyvalue), FileName)
  313. GetDefaultDir = Left$(keyvalue, rc)
  314. keyname = "FILE"
  315. CurAvb = "Autoload.mak"
  316. keyvalue = String$(16, 0)
  317. rc = GetPrivateProfileString(sectionname, keyname, CurAvb, keyvalue, Len(keyvalue), FileName)
  318. GetCurAvb = UCase$(Left$(keyvalue, rc))
  319. End Sub
  320. Sub lstType_Click ()
  321. Dim newpattern As String
  322. Dim stpos As Integer
  323. Dim Endpos As Integer
  324. newpattern = lstType.Text
  325. stpos = InStr(1, newpattern, "(")
  326. Endpos = InStr(1, newpattern, ")")
  327. newpattern = Mid(newpattern, stpos + 1, Endpos - stpos - 1)
  328. file1.Pattern = newpattern
  329. End Sub
  330. Sub mnuChangeDir_Click ()
  331.     frmChDir.Show 1
  332. End Sub
  333. Sub mnuFileItem_Click (Index As Integer)
  334. Select Case Index
  335.     Case 0 'File New
  336.         cmdNew_click
  337.     Case 1 'File Modify
  338.         cmdModify_click
  339.     Case 2 'File Delete
  340.         cmdDel_click
  341.     Case 4 'File Exit
  342.         Unload Me
  343.         End
  344. End Select
  345. End Sub
  346. Sub txtFile_Change ()
  347. If Len(txtFile.Text) = 0 Then
  348.     buttonsOFF
  349.     lstVBX.Clear
  350.     file1.ListIndex = -1
  351.     buttonsOn
  352. End If
  353. End Sub
  354. Sub WriteDefaults ()
  355.     Dim rc As Integer
  356.     Dim keyname As String
  357.     Dim keyvalue As String
  358.     Dim sectionname As String, FileName As String
  359.     FileName = "AutoSwVB.INI"
  360.     sectionname = "Settings"
  361.     keyname = "DIR"
  362.     keyvalue = dftDir
  363.     rc = WritePrivateProfileString(sectionname, ByVal keyname, ByVal keyvalue, FileName)
  364.     keyname = "FILE"
  365.     keyvalue = lblavb.Caption
  366.     rc = WritePrivateProfileString(sectionname, ByVal keyname, ByVal keyvalue, FileName)
  367. End Sub
  368.